package com.example.SigninTest;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.TimeUnit;

import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.NoAlertPresentException;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;



public class GroupDataGenerator {
	static Random rnd = new Random();
	/*
	
	@DataProvider(name = "randomGroups")
	public static Iterator<Object[]> generateRandomGroups() {
		List<GroupObject> groups = new GroupDataGenerator().generateRandomGroupList(5);
		List<Object[]> list = new ArrayList<Object[]>();
		for (GroupObject group : groups) {
			list.add(new Object[]{group});
		}
		return list.iterator();
	}
	*/
	
	@DataProvider(name = "groupsFromFile")
	public static Iterator<Object[]> loadGroupsFromFile() throws IOException{
		List<Object[]> list= new ArrayList<Object[]>();
		BufferedReader reader = new BufferedReader(new FileReader("groups.dat"));
		String line = reader.readLine();
		while (line!=null) {
	//		String[] parts = line.split("\t");
	//		GroupObject group = new GroupObject().setInputLine(parts[0]);
			GroupObject group = new GroupObject().setInputLine(line);
			list.add(new Object[]{group});
			line = reader.readLine();
	
		}
		reader.close();
		return list.iterator();
	}

}
